<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>资金曲线图</title>
    <script type="text/javascript" src="../static/echarts.js"></script>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<style>
    #main {
        margin: auto auto;
    }
</style>
<body>
<div id="main" d = "{{uuid}}" style="width: 1200px;height:800px;"></div>
<script type="text/javascript">
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);
    var option;
    var responseData;
    var categoryData = [];
    var values = [];

    uuid = document.getElementById('main').getAttribute('d');
    $.ajax({
        url: 'api/deal_data_curve',
        data : {'uuid':uuid},
        async: false,
        type: 'GET',
        success: function (data) {
            responseData = data['data_list']
        }
    })
    for (var i = 0; i < responseData.length; i++) {
        categoryData.push(responseData[i][0]);
        values.push(responseData[i][1]);
    }

    option = {
        xAxis: {
            type: 'category',
            data: categoryData
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                data: values,
                type: 'line'
            }
        ]
    };

    option && myChart.setOption(option);
</script>
</body>
</html>